using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;

namespace CurrencyConv.Core.RatesDownloader
{
	[XmlRoot]
	public class CurrencyConvContext
	{
		public List<ExchangeRate> AvailableExchangeRates { get; set; }
		public List<Money> AvailableCurrencies { get; set; }

		public Money FindCurrencyByCode(string code)
		{
			return AvailableCurrencies == null ? null : AvailableCurrencies.FirstOrDefault(c => c.CurrencyCode == code);
		}
	}
}